package com.itheima.boject;

import java.util.Scanner;

public class EqualsDemo {
    public static void main(String[] args) {
        String username = "abcd";
        String password = "123456";
        //键盘录入
        Scanner sc = new Scanner(System.in);
        //循环次数
        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入用户名");
            String scUsername = sc.nextLine();
            System.out.println("请输入密码");
            String scPassword = sc.nextLine();

            //equals 比较两个字符串是否相等,忽略大小写
            if (username.equals(scUsername) && password.equals(scPassword)) {
                System.out.println("登录成功");
                break;
            } else {
                if (i == 3) {
                    System.out.println("今日登录已达到上限,请明天再来");
                } else {
                    System.out.println("今日登录还有" + (3 - i) + "次");
                }
            }
        }
    }
}
